package com.coincalf.exchange.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.coincalf.exchange.entity.EntrustOrder;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;

/**
 * <p>
 * 委托订单信息 Mapper 接口
 * </p>
 *
 * @author qiang
 * @since 2018-05-12
 */
public interface EntrustOrderMapper extends BaseMapper<EntrustOrder> {

    /**
     * 修改币币交易委托订单
     *
     * @param orderId    委托订单号
     * @param lockAmount 冻结金额
     * @param dealVolume 当前成交量
     * @param status     委托订单状态
     */
    int modifyTradeEntrustOrder(@Param("orderId") long orderId,
                                @Param("lockAmount") BigDecimal lockAmount,
                                @Param("dealVolume") BigDecimal dealVolume,
                                @Param("status") int status);

    /**
     * 修改占用保证金
     *
     * @param orderId
     * @param unlockMargin
     * @return
     */
    int modifyLockMargin(@Param("orderId") long orderId, @Param("unlockMargin") BigDecimal unlockMargin);

    /**
     * 将委托订单状态修改为已成交
     *
     * @param orderId 订单号
     * @return
     */
    int modifyTradeEntrustOrderToDeal(@Param("orderId") long orderId);
}
